﻿var item = {
	init : function(dataUrl){
		var box = F("panel");			
		F.get(dataUrl).call2json(function(json){
			var data = [{cat_name:"root", cat_title:"Fw4.0API参考", items:json}];
			this.tree = box.tags("ul").item(0).tree(data,{
				catekey:"cat_title",
				catedes:"cat_name",				
				itemkey:"name",
				itemdes:"title",
				target:"page"
			});
			//this.tree.open(tree.root,[0]);
		}.proxy(this));
		this.setDoor(box.child(0), box.child(1));
		F.js(F.data("js/cnzz.js"));
	},
	//展开或收缩列表
	setDoor : function (leftbox, bar){
		var div = bar.append("div");
		var img = div.append("img");
		var as = [F.data("img/door/show_out.gif"), F.data("img/door/show_over.gif")];
		var ah = [F.data("img/door/hide_out.gif"), F.data("img/door/hide_over.gif")];
		var s1 = leftbox.node.style;
		img.hover(function(){
			img.src(s1.display!="none"?ah[0]:as[1]);
		},function(){
			img.src(s1.display!="none"?ah[1]:as[0]);
		}).bind("mousedown",function(){
			s1.display = s1.display!="none" ? "none" : "";
			img.node.title = s1.display!="none" ? "显示菜单" : "隐藏菜单";
		}).src(ah[1]).attr("title", "隐藏菜单");
	}
};